<?php

include('../../../include/functions.inc.php');
include('../../../include/report.inc.php');
$report = new Report();
$report->ajax = true;
$now = date("Y-m-d");

$report->sql = "SELECT * FROM ( SELECT  CREATED, DESCRIPTION, DATE_LIMIT, AMOUNT 
                                FROM    cllg_cargo
                                WHERE   DATE_PAYED IS NULL AND TOTAL IS NULL AND FK_ACCOUNT=" . getParam("ACCOUNT") . "
                                UNION
                                SELECT  CREATED, DESCRIPTION, DATE_LIMIT, TOTAL_PENDIENTE 
                                FROM    cllg_cargo
                                WHERE   DATE_PAYED IS NULL AND TOTAL>0 AND FK_ACCOUNT=" . getParam("ACCOUNT") . "
                                ) B
                WHERE  B.DATE_LIMIT>=" . sqlValue($now, 'date') . "
                ORDER   BY B.DATE_LIMIT ASC";
//echo $report->sql;
$report->campos = array("CREATED" => "CREADO",
    "DESCRIPTION" => "CARGO",
    "DATE_LIMIT" => "FECHA PAGO",
    "AMOUNT" => "PAGO PENDIENTE");
$report->tipos = array('CREATED' => 'text', 'DESCRIPTION' => 'text', 'DATE_LIMIT' => 'text', "AMOUNT" => "num");
$report->titulo = "Reporte Cargos";
$_SESSION[$report->sessionName] = serialize($report);
$report->ready();
?>